Repository navigation
feat(app-shell): hide the ai:chat menu entry from a member who cannot get an agent; the home falls to the next entry - #37960
objectstack-fleet[bot] wants to merge 7 commits into
Conversation
Claude-Session: https://claude.ai/code/session_016WV4cwGVgec21LwQTtRY85 Co-authored-by: Claude <noreply@anthropic.com>
… a direct link Claude-Session: https://claude.ai/code/session_016WV4cwGVgec21LwQTtRY85 Co-authored-by: Claude <noreply@anthropic.com>
…mpty catalog stops loading; changeset useAgents reports settled per apiBase; useAiSurfaceEnabled reads it instead of a latch that a cache-answered read never set. Warm-cache pins run outside act. Claude-Session: https://claude.ai/code/session_016WV4cwGVgec21LwQTtRY85 Co-authored-by: Claude <noreply@anthropic.com>
…unt settles Claude-Session: https://claude.ai/code/session_016WV4cwGVgec21LwQTtRY85 Co-authored-by: Claude <noreply@anthropic.com>
…he hook and on the ai:chat page Claude-Session: https://claude.ai/code/session_016WV4cwGVgec21LwQTtRY85 Co-authored-by: Claude <noreply@anthropic.com>
… gate's question too Claude-Session: https://claude.ai/code/session_016WV4cwGVgec21LwQTtRY85 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwGVgec21LwQTtRY85 Final head for review: |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT at head 席位核对Shape and gates. 9 files, +828/-22, of which about 690 lines are tests. Check-runs at 4ca23ec: 39 success, 13 skipped, 0 failed. Not governed, and no spec key added (the card's stop condition holds). Point 1, the gate: accepted. Point 2, the Point 3, the two fixtures: accepted. Point 4, new test files: accepted as a declared deviation. The harness files mock Point 5, overlap with #37924 on Acceptance. The community edition case (route not served) and the no-seat case (empty catalog) each show the entry absent and the home on the next entry. A direct link draws Changeset, sentence by sentence. Every bullet matches the code: who is shown the entry, the four surfaces, the home fall-through, a declared landing passed over, the loading hold, the direct link not redirected, the catalog read only while an entry exists, the Landing: not governed, under 3000 lines, no narrowing. The area lands it. |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwGVgec21LwQTtRY85 Landing · area o1-D · 2026-11-27T13:34Z |
Requested by Elon · project thread
Fixes #37833
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
useNavMemberGates.ts,useNavVisibilityAndReads): every navigation surface builds itsvisibleevaluator here: the sidebar (and so the phone's app menu it draws), the app-root landing, the command palette and thenav:menublock. Anai:chatentry (type: 'component',componentRef: AI_CHAT_COMPONENT_REF) is drawn only whenuseAiSurfaceEnabledanswersenabled, the access-filtered agent catalog, which is empty on a deployment with no AI and for a member with no AI seat.readEntryreports it aspending. That reuses the landing's existing pending-read hold (objectui#13097), so the app root shows its skeleton and lands once, either on the page or on the next entry. It never opens one and then jumps to the other. The sidebar never draws the entry and then removes it.landing(ruling record 6545223246, letter A) is unchanged.resolveDeclaredLandingRoutelooks the named entry up among the entries the member is shown, so a landing entry whoseitemis the gatedai:chatentry is passed over: the next declared entry that holds lands, and with none, the first entry shown lands. Both are pinned.component/ai/chatis not gated. The page drawsAiUnavailable.ai:chatentry, through a new optionaluseAiSurfaceEnabled({ enabled }). Apps without one read nothing new (pinned: no request).useAgents(@object-ui/plugin-chatbot) now returnssettled, true once a catalog read for the currentapiBasehas answered or failed. It is additive, and the fields it already returned are unchanged.useAiSurfaceEnabledreads it instead offetchStartedRef. See Acceptance notes..changeset/37833-hide-ai-chat-entry-without-agent.md(patch,@object-ui/app-shelland@object-ui/plugin-chatbot).Read first (by risk)
ui/packages/app-shell/src/hooks/useAiSurface.ts: the latch now readssettled. EveryuseAiSurfaceEnabledconsumer reads itsisLoadingthrough this line.ui/packages/app-shell/src/hooks/useNavMemberGates.ts:useNavVisibilityAndReads, theaiChatterm inevaluateand inreadEntry.ui/packages/plugin-chatbot/src/useAgents.ts:settledForset in the read's.finally.Two-minute verification
pnpm --dir ui exec vitest run packages/app-shell/src/console/__tests__/AppContent.aiChatEntryGate-37833.test.tsx: expect 13 passed, including the community-edition and no-seat home cases whose router pathname log is exactly/apps/policy,/apps/policy/crm_case.Tests
AppContent.aiChatEntryGate-37833.test.tsx(new): realAppContentlanding, realExpressionProvider,MePermissionsProvider,useNavMemberGates,useAiSurfaceEnabled,useAgentsover a heldapiFetch, and the realAppAskPage. The cases:ai:chatentry fetches nothing;AiUnavailable;useAiSurface.warmCatalog-37833.test.tsx(new): the hook on a cold read, then on a warm one, with act off.useAgents.settledWarmCache-37833.test.tsx(new):settledon a cold read, a warm read, a failed read and a disabled read, with act off.useAiSurface.test.ts: its mockeduseAgentsresult now carriessettled, plus one case for a settled empty answer.HomePage.openMarksRead.test.tsx: itsuseAiSurfacemock now also answersuseAiSurfaceEnabled. The Home bell's roster gates navigation throughuseNavMemberGates, so the old mock went red here (a stale fixture caused by this change; it was the only red in the wide run below).Acceptance notes
useAgents' module cache (30 s TTL),isLoadingwent true and false within one render.useAiSurfaceEnabled'sfetchStartedReflatch was never set, so it reported loading for ever. Two effects for a member with no seat after the console's first catalog read: theai:chatpage on a direct link stayed on its blank loading state instead ofAiUnavailable(a defect onmainsince the page landed), and this PR's gate would have held the app-root landing for good. Measured outside act; the pins below fail on the pre-fix code and pass after.askstill shows the entry. The gate followsenabled, the same value the page's own unavailable check reads, and the page'sAiUnavailablecovers it.ai:chatshows a member with no agent the existing no-access empty state, the landing's rule for an app that shows them nothing.useAiSurface.tsis also edited by feat(spec)!: retire the ask_ai action type (ADR-0160 D7) #37924 (draft); the two merge cleanly, and this edit is kept to the latch and theenabledoption.Verification
All runs are on head
4ca23ec3unless noted. Thecheck:*list ran atce385345; the one later commit changes only a test mock, and the four gates that read test files were re-run on4ca23ec3.New and touched pins: 19 passed, and 5 of them red on the pre-fix code
vitest runoveruseAgents.settledWarmCache-37833,useAiSurface.warmCatalog-37833andAppContent.aiChatEntryGate-37833(ce385345): Test Files 3 passed (3), Tests 19 passed (19).useAgents.tsanduseAiSurface.tswere put back to their868742bfcontent in the working tree only (settledhits 0/0, latch hits 3). Result: Tests 5 failed, 14 passed (19). The five red cases are useAgents (a), (b) and (c), the hook's warm-catalog case, and the page's warm direct link. Restored withgit checkout HEAD;git diff HEADempty; both blobs equal to HEAD.node scripts/ablation-replace.mjsat868742bf; anchor hits 1 to 0): theaiChatterm ofevaluatewas replaced bytrue. Result: Tests 8 failed, 4 passed (12). Restored blob equal to HEAD,git diff HEADempty.Wide run and type-check
vitest runoverpackages/plugin-chatbot/and app-shell'shooks/,console/,layout/,chrome/,views/__tests__/andproviders/(ce385345): Test Files 1 failed, 807 passed (808); Tests 3 failed, 7025 passed (7028). The failing file wasHomePage.openMarksRead(No "useAiSurfaceEnabled" export is defined on the mock), repaired in4ca23ec3, where it shows Tests 3 passed (3).Test UIruns all of it in CI.pnpm --filter @object-ui/app-shell --filter @object-ui/plugin-chatbot run type-check: both Done, andpnpm --dir ui exec vitest run scripts/gave Test Files 172 passed, 2 skipped. Lock VERDICT command-exit 0.Derived gates (dispatch-gates --commands, 39 families)
check:*and script families: every one ended with exit 0, exceptcheck:type-check-debt. Its first run exited 3 while it was queued behind the verification lock; the re-run exited 0 (--re-measure: OK, surplus none).pnpm --dir ui exec vitest run scripts/: passed (above).dispatch-gates --ranprinted 39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN.4ca23ec3:check:nul-bytes,check:test-source-alias,check:cross-package-test-inputsandcheck:undeclared-dep-importsall exit 0.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cwGVgec21LwQTtRY85